FROM alpine

#******************设置环境变量******************
ENV JAVA_VERSION=8u252
ENV JAVA_ALPINE_VERSION=8.252.09-r0
ENV LANG=C.UTF-8
ENV JAVA_HOME=/usr/lib/jvm/java-1.8-openjdk
ENV CLASSPATH=$JAVA_HOME/bin
ENV PATH=.:$JAVA_HOME/bin:$PATH

#******************更换Alpine源为mirrors.aliyun.com******************
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories

#******************安装openjdk******************
RUN set -x && apk add --no-cache openjdk8="$JAVA_ALPINE_VERSION"

RUN { echo '#!/bin/sh'; echo 'set -e'; echo; echo 'dirname "$(dirname "$(readlink -f "$(which javac || which java)")")"'; } > /usr/local/bin/docker-java-home && chmod +x /usr/local/bin/docker-java-home

#******************安装字体等******************
RUN apk --update add curl bash ttf-dejavu && rm -rf /var/cache/apk/*

CMD ["java","-version"]
